package com.uzai.common.enums.notice;

import java.util.Objects;

/**
 * The enum Notice order scenes enum.
 *
 * @author mingyang.chen create in 2023/7/13 15:03
 */
public enum NoticeOrderScenesEnum {

    /**
     * Order pay notice order scenes enum.
     */
    order_pay(1, "订单付款"),
    /**
     * Pre sell order pay fix notice order scenes enum.
     * 预售订单付定金
     */
    pre_sell_order_pay_fix(2, "订单付款"),
    /**
     * Pre sell order pay final notice order scenes enum.
     * 预售订单付尾款
     */
    pre_sell_order_pay_final(3, "订单付款"),
    /**
     * Car simple pay order notice order scenes enum.
     * 购物车普通付款订单
     */
    car_simple_pay_order(4, "订单付款"),
    /**
     * Car pre sell order pay notice order scenes enum.
     * 购物车预售付款订单
     */
    car_pre_sell_order_pay(5, "订单付款"),
    /**
     * Order settlement notice order scenes enum.
     */
    order_settlement(6, "订单结算"),
    /**
     * Car order settlement notice order scenes enum.
     * 购物车订单结算
     */
    car_order_settlement(7, "订单结算"),
    /**
     * Order maintain notice order scenes enum.
     * 订单维权
     */
    order_maintain(8, "订单回收"),
    /**
     * Car order maintain notice order scenes enum.
     * 购物车订单维权
     */
    car_order_maintain(9, "订单回收"),
    /**
     * Order punish notice order scenes enum.
     * 处罚订单
     */
    order_punish(10, "订单回收"),
    /**
     * Order refund notice order scenes enum.
     * <p>
     * 订单退款
     */
    order_refund(11, "订单失效"),
    /**
     * Car order refund notice order scenes enum.
     * <p>
     * 购物车订单退款
     */
    car_order_refund(12, "订单失效"),
    /**
     * Order freeze notice order scenes enum.
     * <p>
     * 订单冻结
     */
    order_freeze(13, "审核中"),
    /**
     * Order unfreeze notice order scenes enum.
     * <p>
     * 订单解冻
     */
    order_unfreeze(14, "审核完成"),
    /**
     * Order invalid split notice order scenes enum.
     */
    order_invalid_split(15, "订单失效拆单"),


    ;

    /**
     * The Code.
     */
    public final Integer code;
    /**
     * The Desc.
     */
    public final String desc;

    NoticeOrderScenesEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * Gets code.
     *
     * @return the code
     */
    public Integer getCode() {
        return code;
    }

    /**
     * Gets desc.
     *
     * @return the desc
     */
    public String getDesc() {
        return desc;
    }

    /**
     * Gets by code.
     *
     * @param code the code
     * @return the by code
     */
    public static NoticeOrderScenesEnum getByCode(Integer code) {
        for (NoticeOrderScenesEnum value : NoticeOrderScenesEnum.values()) {
            if (Objects.equals(value.code, code)) {
                return value;
            }
        }
        return null;
    }


    /**
     * Gets desc.
     *
     * @param code the code
     * @return the desc
     */
    public static String getDesc(Integer code) {
        if (getByCode(code) == null) {
            return null;
        }
        return getByCode(code).getDesc();
    }
}
